package com.wzcl.app.dao.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wzcl.app.dao.model.common.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.List;

@Data
@Entity
@Table(name = "topicInfo")
@ApiModel(value = "题目表小题表")
@EntityListeners(AuditingEntityListener.class)
public class TopicInfo implements Base {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "题目类型")
    private Integer type;

    @ApiModelProperty(value = "题目")
    @Column(columnDefinition = "text")
    private String  branch;

    @ApiModelProperty(value = "题目答案")
    @Column(columnDefinition = "text")
    private String  answer;

    @ApiModelProperty(value = "答案解析")
    @Column(columnDefinition = "text")
    private String  analysis;

    @ApiModelProperty(value = "分值")
    private Integer score;

    @ApiModelProperty(value = "排序字段")
    private Integer orderNo;

    @ManyToOne
    @JsonIgnore
    @JoinColumn(name="topicId")
    private Topic topic;

    @OneToMany(cascade = CascadeType.REMOVE,mappedBy = "topicInfo")
    private List<TopicOption> optionList;
}
